<?php
$this->headLink()->appendStylesheet($this->baseUrl('css/dhtmlXTree.css'));

$this->headScript()->appendFile($this->baseUrl('js/dhtmlx/dhtmlXProtobar.js'))
				   ->appendFile($this->baseUrl('js/dhtmlx/dhtmlXMenuBar.js'))
				   ->appendFile($this->baseUrl('js/dhtmlx/dhtmlXMenuBar_cp.js'))
				   ->appendFile($this->baseUrl('js/dhtmlx/dhtmlXCommon.js'))
				   ->appendFile($this->baseUrl('js/dhtmlx/dhtmlXTree.js'))
				   ->appendFile($this->baseUrl('js/dhtmlx/dhtmlXGrid.js'))
				   ->appendFile($this->baseUrl('js/dhtmlx/dhtmlXGridCell.js'))
				   ->appendFile($this->baseUrl('js/dhtmlx/dhtmlXGrid_excell_link.js'));
//$pagina=$this->baseUrl('arbol_opciones.phtml');
$rutaimg=$this->baseUrl('img/arbol/');
/*
$pagina=$this->url(
    array(
    	'module'	 => 'roles',
        'controller' => 'funcionalidades',
        'action'     => 'arbol'
    ),
    'default',
    true);
*/
if($this->cod_rol!=""){
//if($this->cod_rol!="" || $this->codpadre!=""){
$pagina="/cna/roles/funcionalidades/arbol/codigo/".$this->cod_rol;//1
//if($this->codpadre!="") $pagina="/cna/roles/funcionalidades/arbol/codpadre/".$this->codpadre;
//echo "Pagina:".$pagina."<br>";
?>
<TABLE class="TABLA_BORDE_SACES" width="98%" align="center" cellpadding="0" cellspacing="0">
      <TR class="TABLA_ENCABEZADO_SACES">
      		<TH align="left">Funcionalidades disponibles </TH>
      </TR>
 </table>
<TABLE width="98%" align=center>
    <TR align="left">
        <TD>
			<a href="javascript:tree.openAllItems(0);"><img src="<?php echo $rutaimg;?>folderOpen.gif" border="0" align="middle">&nbsp;Expandir todos</a>&nbsp;&nbsp;&nbsp;
			<a href="javascript:tree.closeAllItems(0);"><img src="<?php echo $rutaimg;?>folderClosed.gif" border="0" align="middle">&nbsp;Cerrar todos</a>
		</TD>
     </TR>
     <TR class="last" align="left">
        <TD>
  			<div id="treeboxbox_tree" style="width:250; height:218;background-color:#f5f5f5;border :1px solid Silver; overflow:auto;"></div>
  		</TD>
    </TR>
</TABLE>
<script>
	tree=new dhtmlXTreeObject("treeboxbox_tree","100%","100%",0);
	tree.setImagePath("<?php echo $rutaimg;?>");
	tree.enableCheckBoxes(1);
	tree.enableThreeStateCheckboxes(true);

	tree.loadXML("<?php echo $pagina?>");
	tree.enableTreeLines(true);
	tree.setImageArrays("plus","plus2.gif","plus3.gif","plus4.gif","plus.gif","plus5.gif");
	tree.setImageArrays("minus","minus2.gif","minus3.gif","minus4.gif","minus.gif","minus5.gif");
	tree.setStdImages("hoja.gif","folderOpen.gif","folderClosed.gif");
	
</script>
<?php }
else{?>
Debe pasar el parametro codrol y quedar un URL como:
http://saces/cna/roles/funcionalidades/index/codrol/17
<?php }?>